package cn.hairui.blog.repository;

import cn.hairui.blog.mapper.LinkMapper;
import cn.hairui.blog.model.Link;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * <h2>请添加说明
 * </h2>
 * <ol>请添加详细说明
 * </ol>
 *
 * <h2>修改历史
 * </h2>
 * <ol>如有修改，请添加修改历史
 * </ol>
 *
 * </p>
 *
 * @author laoganbu
 * @version V1.0
 * @date 2019/7/29 19:15
 */
@Repository
public class LinkRepository {

    @Autowired
    private LinkMapper linkMapper;

    public List<Link> findLimited(String status, int count) {
        return linkMapper.findLimited(status, count);
    }

    public List<Map> list() {
        return linkMapper.list();
    }

    public void delete(int id) {
        linkMapper.deleteById(id);
    }

    public Link find(int id) {
        return linkMapper.find(id);
    }

    public void add(Link link) {
        linkMapper.insert(link);
    }

    public void updateSts(int id, int status) {
        linkMapper.updateSts(id, status);
    }
}
